<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="author" content="lijun; 67086071; zwlijun@qq.com" />
<title>RIA Client API - BY 小网</title>
<link href="css/api.css" type="text/css" rel="stylesheet" />
</head>

<body>
  <ins>此文档描述JSelect对象和JOption对象</ins>
  <div class="nav">
    <a href="#JSelect">JSelect()</a>
    <a href="#JOption">JOption()</a>
    <a href="#setEventHandler">setEventHandler()</a>
    <a href="#setAttributes">setAttributes()</a>
    <a href="#create">create()</a>
    <a href="#done">done()</a>
    <a href="#add">add()</a>
    <a href="#remove">remove()</a>
  </div>
  <table width="600" cellspacing="1" cellpadding="1" border="0">
    <tbody>
      <tr>
        <th colspan="2">JSelect()<a name="JSelect"></a></th>
      </tr>
      <tr>
        <td class="label">作&nbsp;&nbsp;&nbsp;用</td>
        <td>构造函数</td>
      </tr>
      <tr>
        <td class="label">基本语法</td>
        <td>var jsel = new JSelect();</td>
      </tr>
      <tr>
        <td class="label">说&nbsp;&nbsp;&nbsp;明</td>
        <td>构造函数</td>
      </tr>
      <tr>
        <td class="label">示&nbsp;&nbsp;&nbsp;例</td>
        <td>
<pre>
var jsel = new JSelect();
</pre>
        </td>
      </tr>
    </tbody>
  </table>
  <table width="600" cellspacing="1" cellpadding="1" border="0">
    <tbody>
      <tr>
        <th colspan="2">JOption方法<a name="JOption"></a></th>
      </tr>
      <tr>
        <td class="label">作&nbsp;&nbsp;&nbsp;用</td>
        <td>构造函数</td>
      </tr>
      <tr>
        <td class="label">基本语法</td>
        <td>var jopt = new JOption(text, vlaue, defaultSelected, selected);</td>
      </tr>
      <tr>
        <td class="label">说&nbsp;&nbsp;&nbsp;明</td>
        <td>构造函数</td>
      </tr>
      <tr>
        <td class="label">示&nbsp;&nbsp;&nbsp;例</td>
        <td>
<pre>
var jopt = new JOption("深圳", "SZ", true, true);
</pre>
        </td>
      </tr>
    </tbody>
  </table>
  <table width="600" cellspacing="1" cellpadding="1" border="0">
    <tbody>
      <tr>
        <th colspan="2">setEventHandler方法<a name="setEventHandler"></a></th>
      </tr>
      <tr>
        <td class="label">作&nbsp;&nbsp;&nbsp;用</td>
        <td>设置事件处理函数</td>
      </tr>
      <tr>
        <td class="label">基本语法</td>
        <td>
<pre>
jsel.setEventHandler(events);
events{
  $onchange : null,
  $onclick : null,
  $ondblclick : null,
  $onmouseover : null,
  $onmouseout : null,
  $onmousedown : null,
  $onmousemove : null,
  $onfocus : null,
  $onblur : null,
  $onkeyup : null,
  $onkeydown : null,
  $onkeypress : null
}
</pre>
        </td>
      </tr>
      <tr>
        <td class="label">说&nbsp;&nbsp;&nbsp;明</td>
        <td>设置事件处理函数</td>
      </tr>
      <tr>
        <td class="label">示&nbsp;&nbsp;&nbsp;例</td>
        <td>
<pre>
jsel.setEventHandler({
  $onchange : doChanged
});
</pre>
        </td>
      </tr>
    </tbody>
  </table>
  <table width="600" cellspacing="1" cellpadding="1" border="0">
    <tbody>
      <tr>
        <th colspan="2">setAttributes方法<a name="setAttributes"></a></th>
      </tr>
      <tr>
        <td class="label">作&nbsp;&nbsp;&nbsp;用</td>
        <td>设置select的属性</td>
      </tr>
      <tr>
        <td class="label">基本语法</td>
        <td>
<pre>
jsel.setAttributes(attrs);
attrs{
  $name : null,
  $id : null,
  width : 128,
  height : 20,
  optionHeight : 20
}
</pre>
        </td>
      </tr>
      <tr>
        <td class="label">说&nbsp;&nbsp;&nbsp;明</td>
        <td>设置select的属性</td>
      </tr>
      <tr>
        <td class="label">示&nbsp;&nbsp;&nbsp;例</td>
        <td>
<pre>
jsel.setAttributes({$id:"test", $name:"test", width:200, height:20});
</pre>
        </td>
      </tr>
    </tbody>
  </table>
  <table width="600" cellspacing="1" cellpadding="1" border="0">
    <tbody>
      <tr>
        <th colspan="2">create方法<a name="create"></a></th>
      </tr>
      <tr>
        <td class="label">作&nbsp;&nbsp;&nbsp;用</td>
        <td>创建select框</td>
      </tr>
      <tr>
        <td class="label">基本语法</td>
        <td>jsel.create(target);</td>
      </tr>
      <tr>
        <td class="label">说&nbsp;&nbsp;&nbsp;明</td>
        <td>创建select框</td>
      </tr>
      <tr>
        <td class="label">示&nbsp;&nbsp;&nbsp;例</td>
        <td>
<pre>
jsel.create("sel");
</pre>
        </td>
      </tr>
    </tbody>
  </table>
  <table width="600" cellspacing="1" cellpadding="1" border="0">
    <tbody>
      <tr>
        <th colspan="2">done方法<a name="done"></a></th>
      </tr>
      <tr>
        <td class="label">作&nbsp;&nbsp;&nbsp;用</td>
        <td>创建完成</td>
      </tr>
      <tr>
        <td class="label">基本语法</td>
        <td>jsel.done();</td>
      </tr>
      <tr>
        <td class="label">说&nbsp;&nbsp;&nbsp;明</td>
        <td>创建完成，在最后调用</td>
      </tr>
      <tr>
        <td class="label">示&nbsp;&nbsp;&nbsp;例</td>
        <td>
<pre>
jsel.done();
</pre>
        </td>
      </tr>
    </tbody>
  </table>
  <table width="600" cellspacing="1" cellpadding="1" border="0">
    <tbody>
      <tr>
        <th colspan="2">add方法<a name="add"></a></th>
      </tr>
      <tr>
        <td class="label">作&nbsp;&nbsp;&nbsp;用</td>
        <td>添加一个option</td>
      </tr>
      <tr>
        <td class="label">基本语法</td>
        <td>jsel.add(option);</td>
      </tr>
      <tr>
        <td class="label">说&nbsp;&nbsp;&nbsp;明</td>
        <td>添加一个option</td>
      </tr>
      <tr>
        <td class="label">示&nbsp;&nbsp;&nbsp;例</td>
        <td>
<pre>
var jsel = new JSelect();
jsel.setEventHandler({
  $onchange : doChanged
});
jsel.setAttributes({$id:"test", $name:"test", width:200, height:20});
jsel.create("sel");
jsel.add(new JOption("请选择", ""));
jsel.add(new JOption("深圳", "SZ", true, true));
jsel.add(new JOption("北京", "BJ"));
jsel.add(new JOption("上海", "SH"));
jsel.add(new JOption("广州", "GZ"));
jsel.add(new JOption("长沙", "CS"));
jsel.done();
</pre>
        </td>
      </tr>
    </tbody>
  </table>
  <table width="600" cellspacing="1" cellpadding="1" border="0">
    <tbody>
      <tr>
        <th colspan="2">remove方法<a name="remove"></a></th>
      </tr>
      <tr>
        <td class="label">作&nbsp;&nbsp;&nbsp;用</td>
        <td>删除一个option</td>
      </tr>
      <tr>
        <td class="label">基本语法</td>
        <td>jsel.remove(index);</td>
      </tr>
      <tr>
        <td class="label">说&nbsp;&nbsp;&nbsp;明</td>
        <td>删除一个option</td>
      </tr>
      <tr>
        <td class="label">示&nbsp;&nbsp;&nbsp;例</td>
        <td>
<pre>
jsel.remove(0)
</pre>
        </td>
      </tr>
    </tbody>
  </table>
</body>
</html>